﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.ProviderBase;
using System.Data.Common;
using System.Data.SqlClient;

namespace Code
{
    public class BasketController
    {
        BasketDataAccess _dataAccess;
        public BasketController()
        {
            _dataAccess = new BasketDataAccess();
        }

        public DataTable getListBasket(int memID)
        {
            return _dataAccess.getListBasket(memID);
        }

        public DataTable getBasketDetail(int bID)
        {
            return _dataAccess.getBasketDetail(bID);
        }

        public int getCurrentBasketID(int memID)
        {
            return _dataAccess.getCurrentBasketID(memID);
        }

        public void setCurrentBasketID(int bID)
        {
            _dataAccess.setCurrentBasketID(bID);
        }

        public void addNewBasket(int memID)
        {
            _dataAccess.addNewBasket(memID);
        }

        public void updatePrice(int bID)
        {
            _dataAccess.updatePrice(bID);
        }

        public void deleteBasket(int bID, int memID)
        {
            _dataAccess.deleteBasket(bID, memID);
        }

        public void removeFromBasket(int bID, int bdID)
        {
            _dataAccess.removeFromBasket(bID, bdID);
        }

        public void updateProductQuan(int bdID, int quan)
        {
            _dataAccess.updateProductQuan(bdID, quan);
        }

        public int getMaxQuantity(int imgID)
        {
            return _dataAccess.getMaxQuantity(imgID);
        }

        public void addToBasket(int basketID, int productID, int colorID, int quantity)
        {
            _dataAccess.addToBasket(basketID, productID, colorID, quantity);
        }

        public bool checkAllPriceUpdated(int bID)
        {
            return _dataAccess.checkAllPriceUpdated(bID);
        }

        public bool checkAppropriateQuantity(int bID)
        {
            return _dataAccess.checkAppropriateQuantity(bID);
        }

        public bool checkBasketEmpty(int bID)
        {
            return _dataAccess.checkBasketEmpty(bID);
        }

        public bool checkValidBasket(int mID, int bID)
        {
            return _dataAccess.checkValidBasket(mID, bID);
        }

        public int getTotalPrice(int bID)
        {
            return _dataAccess.getTotalPrice(bID);
        }

        public DataTable getPTTT()
        {
            return _dataAccess.getPTTT();
        }

        public DataTable getPTGH()
        {
            return _dataAccess.getPTGH();
        }

        public DataTable getBank()
        {
            return _dataAccess.getBank();
        }

        public int payBasket(
            int memID,
            int basketID,
            int totalPrice,
            int ptgh,
            int pttt,
            string sTenNguoiNhan,
            string sDiaChiNguoiNhan,
            string sSoDTNguoiNhan,
            string sSoTaiKhoanCongTy,
            string sTenNganHang)
        {
            return _dataAccess.payBasket(
                memID,
                basketID,
                totalPrice,
                ptgh,
                pttt,
                sTenNguoiNhan,
                sDiaChiNguoiNhan,
                sSoDTNguoiNhan,
                sSoTaiKhoanCongTy,
                sTenNganHang);
        }

        public DataTable getOrderDetail(int oID)
        {
            return _dataAccess.getOrderDetail(oID);
        }

        public void getOrderInfo(int oID, out string sHoTenNguoiNhan, out string sDiaChiNguoiNhan, out string sSoDTNguoiNhan, out string sTongTien, out string sNgayGiaoDich)
        {
            _dataAccess.getOrderInfo(oID, out sHoTenNguoiNhan, out sDiaChiNguoiNhan, out sSoDTNguoiNhan, out sTongTien, out sNgayGiaoDich);
        }
    }
}